﻿using Ln.Fram.SqlSugarCore.Abstractions;
using Ln.Rbac.Domain.Entities;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;

namespace Ln.Rbac.SqlSugarCore.DataSeeds;

public class DictionaryDataSeed : IDataSeedContributor, ITransientDependency
{
	#region 构造函数
	public DictionaryDataSeed(ISqlSugarRepository<DictionaryEntity> repository)
	{
		_repository = repository;
	}
	#endregion

	#region 成员属性
	private ISqlSugarRepository<DictionaryEntity> _repository;
	#endregion

	#region 自身方法
	public async Task SeedAsync(DataSeedContext context) { if (!await _repository.IsAnyAsync(x => true)) await _repository.InsertManyAsync(GetSeedData()); }

	public List<DictionaryEntity> GetSeedData()
	{
		List<DictionaryEntity> entities = new List<DictionaryEntity>();
		entities.AddRange([
			new() { DictLabel = "男", DictValue = "Male", DictType = "sys_user_sex", OrderNum = 100, Remark = "性别-男", IsDeleted = false, State = true },
			new() { DictLabel = "女", DictValue = "Woman", DictType = "sys_user_sex", OrderNum = 99, Remark = "性别-女", IsDeleted = false, State = true },
			new() { DictLabel = "未知", DictValue = "Unknown", DictType = "sys_user_sex", OrderNum = 98, Remark = "性别-未知", IsDeleted = false, State = true },
			new() { DictLabel = "显示", DictValue = "true", DictType = "sys_show_hide", OrderNum = 100, Remark = "显示菜单", IsDeleted = false, State = true },
			new() { DictLabel = "隐藏", DictValue = "false", DictType = "sys_show_hide", OrderNum = 99, Remark = "隐藏菜单", IsDeleted = false, State = true },
			new() { DictLabel = "正常", DictValue = "true", DictType = "sys_normal_desable", OrderNum = 10, Remark = "正常状态", IsDeleted = false, State = true },
			new() { DictLabel = "停用", DictValue = "false", DictType = "sys_normal_desable", OrderNum = 99, Remark = "停用状态", IsDeleted = false, State = true, ListClass = "danger" },
			new() { DictLabel = "正常", DictValue = "0", DictType = "sys_job_status", OrderNum = 100, Remark = "正常状态", IsDeleted = false, State = true },
			new() { DictLabel = "暂停", DictValue = "1", DictType = "sys_job_status", OrderNum = 99, Remark = "暂停状态", IsDeleted = false, State = true, ListClass = "danger" },
			new() { DictLabel = "默认", DictValue = "DEFAULT", DictType = "sys_job_group", OrderNum = 100, Remark = "默认分组", IsDeleted = false, State = true },
			new() { DictLabel = "系统", DictValue = "SYSTEM", DictType = "sys_job_group", OrderNum = 99, Remark = "系统分组", IsDeleted = false, State = true },
			new() { DictLabel = "是", DictValue = "Y", DictType = "sys_yes_no", OrderNum = 100, Remark = "系统默认是", IsDeleted = false, State = true },
			new() { DictLabel = "否", DictValue = "N", DictType = "sys_yes_no", OrderNum = 99, Remark = "系统默认否", IsDeleted = false, State = true, ListClass = "danger" },
			new() { DictLabel = "通知", DictValue = "1", DictType = "sys_notice_type", OrderNum = 100, Remark = "通知", IsDeleted = false, State = true },
			new() { DictLabel = "公告", DictValue = "2", DictType = "sys_notice_type", OrderNum = 99, Remark = "公告", IsDeleted = false, State = true },
			new() { DictLabel = "正常", DictValue = "0", DictType = "sys_notice_status", OrderNum = 100, Remark = "正常状态", IsDeleted = false, State = true },
			new() { DictLabel = "关闭", DictValue = "1", DictType = "sys_notice_status", OrderNum = 99, Remark = "关闭状态", IsDeleted = false, State = true, ListClass = "danger" },
			new() { DictLabel = "新增", DictValue = "Insert", DictType = "sys_oper_type", OrderNum = 100, Remark = "新增操作", IsDeleted = false, State = true },
			new() { DictLabel = "修改", DictValue = "Update", DictType = "sys_oper_type", OrderNum = 99, Remark = "修改操作", IsDeleted = false, State = true },
			new() { DictLabel = "删除", DictValue = "Delete", DictType = "sys_oper_type", OrderNum = 98, Remark = "删除操作", IsDeleted = false, State = true },
			new() { DictLabel = "授权", DictValue = "Auth", DictType = "sys_oper_type", OrderNum = 97, Remark = "授权操作", IsDeleted = false, State = true },
			new() { DictLabel = "导出", DictValue = "Export", DictType = "sys_oper_type", OrderNum = 96, Remark = "导出操作", IsDeleted = false, State = true },
			new() { DictLabel = "导入", DictValue = "Import", DictType = "sys_oper_type", OrderNum = 95, Remark = "导入操作", IsDeleted = false, State = true },
			new() { DictLabel = "强退", DictValue = "ForcedOut", DictType = "sys_oper_type", OrderNum = 94, Remark = "强退操作", IsDeleted = false, State = true },
			new() { DictLabel = "生成代码", DictValue = "GenerateCode", DictType = "sys_oper_type", OrderNum = 93, Remark = "生成代码操作", IsDeleted = false, State = true },
			new() { DictLabel = "清空数据", DictValue = "ClearData", DictType = "sys_oper_type", OrderNum = 92, Remark = "清空数据操作", IsDeleted = false, State = true, ListClass = "danger" },
			new() { DictLabel = "成功", DictValue = "false", DictType = "sys_common_status", OrderNum = 100, Remark = "正常状态", IsDeleted = false, State = true },
			new() { DictLabel = "失败", DictValue = "true", DictType = "sys_common_status", OrderNum = 99, Remark = "失败状态", IsDeleted = false, State = true, ListClass = "danger" },
		]);
		return entities;
	}
	#endregion
}
